﻿using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid.Customization;
using System.Collections.Generic;
using System.Windows.Forms;

namespace Aker
{
    public partial class XForm : XtraForm
    {
        public XForm()
        {
            InitializeComponent();
        }

        public delegate void BarcodeReadHandler(int Barcode);
        public event BarcodeReadHandler BarcodeRead;

        public static void ShowError(string message)
        {
            XtraMessageBox.Show(message, "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }

        public static void ShowInfo(string message)
        {
            XtraMessageBox.Show(message, "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
        public static DialogResult Ask(string question)
        {
            return XtraMessageBox.Show(question, "Uyarı", MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
        }
        public void FireBarcodeRead(int Barcode)
        {
            if (BarcodeRead != null)
                this.BeginInvoke(new BarcodeReadHandler(BarcodeRead), new object[] { Barcode });


        }

        private void XForm_Shown(object sender, System.EventArgs e)
        {
            MainMenu.Visible = MainMenu.ItemLinks.Count > 0;
            FooterBar.Visible = FooterBar.ItemLinks.Count > 0;
        }

        public List<CustomizationForm> CustomizationForms = new List<CustomizationForm>();
    }
}